<?php
//Remote Procedure Call (RPC).
//SOAP == Simple Object Access Protocol
//powerful tool for communication between disparate systems

//A SOAP Web service is defined by using a Web Service Description Language
//(WSDL, pronounced ג€�whisdlג€�) document. This, in turn,
//is yet another XML document that describes the function calls made available by a Web service, as well as
//any specialized data types needed by it.

//Accessing SOAP-based Web Services
//http://www.soapclient.com/googlesearch.html
try
{
	$pathToWsdl = 'http://footballpool.dataaccess.eu/data/info.wso?wsdl';
	/*$client = new SoapClient($pathToWsdl);
	//var_dump($client->__getFunctions());die;
	//var_dump($client->TopGoalScorers(array('iTopN'=>5)));die;
	$result = $client->TopGoalScorers(array('iTopN'=>5));
	//var_dump($result->TopGoalScorersResult->tTopGoalScorer);die;
	$topGoalScorers = $result->TopGoalScorersResult->tTopGoalScorer;
	foreach ($topGoalScorers as $goal){
		?><tr>
			<td><?php echo $goal->sName;?></td>
			<td><?php echo $goal->iGoals;?></td>
			<td><?php echo $goal->sCountry;?></td>
			<td><?php echo $goal->sFlag;?></td>
			<td><?php echo $goal->sFlagLarge;?></td>
		</tr><?php  
		//var_dump($goal);die;
		//echo 
	} */
	//die;
	//Debugging
	$client = new SoapClient($pathToWsdl, array('trace' => 1,'exceptions' => true));
	$result = $client->TopGoalScorers(array('iTopN'=>5));
	//header("Content-type: text\xml");
//	echo $client->__getLastRequest();
	//echo $client->__getLastResponse();
	var_dump($client->__getLastRequestHeaders());
	var_dump($client->__getLastResponseHeaders());
	
}catch (SoapFault $e){
	//var_dump($client->__getLastRequestHeaders());
	//header("Content-type: text\xml");
	//echo $client->__getLastRequest();
	var_dump($e->getMessage());
}